<template>
	<view class="u-content">
		<view class="title">
			<text>{{infoData.companyName}}</text>
		</view>
		<view class="actor">
			<!-- <u-avatar :src="src" class="acatar-box" size="40"></u-avatar> -->
			<text>{{infoData.name}}</text>
		</view>
		<view class="content">
			{{infoData.content==null?"":infoData.content}}
			<!-- <rich-text :node="infoData.content==null?'':infoData.content"></rich-text> -->
		</view>
		<view class="img-box">
			<view class="img-wrap" v-for="(item,index) in infoData.image" :key="index">
				<img :src="item" alt="">
			</view>
		</view>
		<view class="read-box">
			<text>阅读{{visitNumber}}</text>
		</view>
		<view class="contact-box">
			<view class="contact-wrap">
				<u-button type="primary" text="立即联系" @click="toBusinessCard"></u-button>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				infoData: {

				},
			}

		},
		computed: {
			...mapState(['visitNumber']),
		},
		onShow() {
			console.log(this.visitNumber)
			this.getInfos()
		},
		methods: {
			getInfos() {
				let id = uni.getStorageSync('businessInfoId')
				this.$api.getBusinessListInfo(id).then(res => {
					console.log(res)


					if (res.success) {
						// uni.showToast({
						// 	title:res.message,
						// 	icon: 'none'
						// });
						
						this.infoData = res.result
						this.infoData.image = JSON.parse(this.infoData.image)
					}
				})
			},
			// 去企业名片
			toBusinessCard() {
				let businessId = this.infoData.cardId
			
				uni.setStorageSync('businessCardId', businessId)
				uni.navigateTo({
					url: '/pagesBusiness/business/businessCard'
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.u-content {
		// background: #F8F9FF;
		padding:  30rpx 50rpx 150rpx 50rpx;
		position: relative;

		.title {
			font-size: 40rpx;
			font-weight: 600;
			line-height: 60rpx;
		}

		.actor {
			display: flex;
			margin-top: 15rpx;
			font-size: 24rpx;
			// font-weight: 600;
			line-height: 60rpx;
			color: #7f7f7f;
		}

		.content {
			letter-spacing: 3upx;
			line-height: 40upx;
		}

		.img-box {
			margin-top: 30upx;

			.img-wrap {
				height: 400upx;
				width: 100%;
				// background: red;
				text-align: center;
				margin-top: 10upx;

				img {
					width: 100%;
					height: 400upx;
					

				}
			}
		}

		.read-box {
			margin-top: 30upx;
			font-size: 26rpx;
			// font-weight: 600;
			line-height: 60rpx;
			color: #7f7f7f;
		}

		.contact-box {
			// background: red;
			position: fixed;
			width: 100%;
			// height: 120upx;
			bottom: 0;
			left: 0;
			padding: 30upx 0;

			.contact-wrap {
				width: 90%;
				margin: 0 auto;
			}
		}
	}
</style>
